package com.atguigu.democustomer230201.mapper;

import com.atguigu.democustomer230201.bean.Customer;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
@DS("test")
public interface CustomerMapper extends BaseMapper<Customer> {

    @Select("select * from customer where name=#{name} and age = #{age}")
    public Customer selectCustomerByNameWithAge(@Param("name") String name, @Param("age") Integer age);

    @Select("select * from customer where id=${id}")
    public Customer selectCustomerById(@Param("id") String id);


    @Insert("insert into customer(name,age) values(#{customer.name},#{customer.age})")
    @DS("demo")
    public void insertCustomer(@Param("customer") Customer customer);
}
